package com.ruoyi.web.controller.dispatch;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DispatchPipeNetworkMonitoringPressureRecords;
import com.ruoyi.system.service.IDispatchPipeNetworkMonitoringPressureRecordsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 管网监测压力记录Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/dispatchPipeNetworkMonitoringPressureRecords")
public class DispatchPipeNetworkMonitoringPressureRecordsController extends BaseController
{
    @Autowired
    private IDispatchPipeNetworkMonitoringPressureRecordsService dispatchPipeNetworkMonitoringPressureRecordsService;

    /**
     * 查询管网监测压力记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPipeNetworkMonitoringPressureRecords:list')")
    @GetMapping("/list")
    public TableDataInfo list(DispatchPipeNetworkMonitoringPressureRecords dispatchPipeNetworkMonitoringPressureRecords)
    {
        startPage();
        List<DispatchPipeNetworkMonitoringPressureRecords> list = dispatchPipeNetworkMonitoringPressureRecordsService.selectDispatchPipeNetworkMonitoringPressureRecordsList(dispatchPipeNetworkMonitoringPressureRecords);
        return getDataTable(list);
    }

    /**
     * 导出管网监测压力记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPipeNetworkMonitoringPressureRecords:export')")
    @Log(title = "管网监测压力记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DispatchPipeNetworkMonitoringPressureRecords dispatchPipeNetworkMonitoringPressureRecords)
    {
        List<DispatchPipeNetworkMonitoringPressureRecords> list = dispatchPipeNetworkMonitoringPressureRecordsService.selectDispatchPipeNetworkMonitoringPressureRecordsList(dispatchPipeNetworkMonitoringPressureRecords);
        ExcelUtil<DispatchPipeNetworkMonitoringPressureRecords> util = new ExcelUtil<DispatchPipeNetworkMonitoringPressureRecords>(DispatchPipeNetworkMonitoringPressureRecords.class);
        util.exportExcel(response, list, "管网监测压力记录数据");
    }

    /**
     * 获取管网监测压力记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPipeNetworkMonitoringPressureRecords:query')")
    @GetMapping(value = "/{pipeNetworkMonitoringPressureRecordsId}")
    public AjaxResult getInfo(@PathVariable("pipeNetworkMonitoringPressureRecordsId") Long pipeNetworkMonitoringPressureRecordsId)
    {
        return success(dispatchPipeNetworkMonitoringPressureRecordsService.selectDispatchPipeNetworkMonitoringPressureRecordsByPipeNetworkMonitoringPressureRecordsId(pipeNetworkMonitoringPressureRecordsId));
    }

    /**
     * 新增管网监测压力记录
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPipeNetworkMonitoringPressureRecords:add')")
    @Log(title = "管网监测压力记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DispatchPipeNetworkMonitoringPressureRecords dispatchPipeNetworkMonitoringPressureRecords)
    {
        return toAjax(dispatchPipeNetworkMonitoringPressureRecordsService.insertDispatchPipeNetworkMonitoringPressureRecords(dispatchPipeNetworkMonitoringPressureRecords));
    }

    /**
     * 修改管网监测压力记录
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPipeNetworkMonitoringPressureRecords:edit')")
    @Log(title = "管网监测压力记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DispatchPipeNetworkMonitoringPressureRecords dispatchPipeNetworkMonitoringPressureRecords)
    {
        return toAjax(dispatchPipeNetworkMonitoringPressureRecordsService.updateDispatchPipeNetworkMonitoringPressureRecords(dispatchPipeNetworkMonitoringPressureRecords));
    }

    /**
     * 删除管网监测压力记录
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPipeNetworkMonitoringPressureRecords:remove')")
    @Log(title = "管网监测压力记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{pipeNetworkMonitoringPressureRecordsIds}")
    public AjaxResult remove(@PathVariable Long[] pipeNetworkMonitoringPressureRecordsIds)
    {
        return toAjax(dispatchPipeNetworkMonitoringPressureRecordsService.deleteDispatchPipeNetworkMonitoringPressureRecordsByPipeNetworkMonitoringPressureRecordsIds(pipeNetworkMonitoringPressureRecordsIds));
    }
}
